<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;

class LoginController extends BaseController
{
    public function login(Request $request){
       /* Auth::logout();*/
        return view('auth/login',[
            'msg'=>''
        ]);
    }
    public function doLogin(Request $request){
        $str_userName = $request->input('name');
        $str_passwd = $request->input('passwd');
        if (Auth::attempt(['name'=>$str_userName, 'password'=>$str_passwd])){
            return redirect('/');
        }
        return view('auth/login',[
            'msg'=>'用户名或密码错误'
        ]);
    }

    public function logOut(Request $request){
        Auth::logout();
        return redirect('/login');
    }

}
